<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>demo2-9</title>
    <script src="vue.js"></script>
</head>

<body>
    <p>单击按钮修改文本</p>
    <div id="app">
        <p>{{msg}}</p>
        <button @click="doChange">请单击</button>
    </div>
    <script>
        const comApp = {
            data() {
                return {
                    msg:"初始文本！"
                }
            },
            methods:{
                doChange(){
                    this.msg="新的文本！"
                }
     
            }
        }
        Vue.createApp(comApp).mount('#app')
    </script>
</body>
</html>